<?php

namespace fanletter\manager;

/**
 * 
 * manages the Content-Objects 
 * @author Evan
 *
 */
class ContentManager
{
	private static $instance;
	private $contents;
	
	private function __construct()
	{
		
	}
	
	/**
	 * 
	 * @return ContentManager
	 */
	public static function getInstance()
	{
		if (self::instance === NULL)
		{
			self::$instance = new self();
		}
		return self::$instance;
	}
	
	public function getContentByNewsletterId($id)
	{
		//TODO: Fetch data from Database
		//XXX: Note, that you have to check, if an order-number is used.
	}
	
	public function getContentById($id)
	{
		if (is_array($this->contents))
		{
			if (isset($this->contents[$id]))
			{
				return $this->contents[$id];
			}
		}
		return $this->getContentFromDbById($id);
	}
	
	private function getContentFromDbById($id)
	{
		//TODO: Fetch data from Database
	}
	
}
